﻿/* forums table */

  ALTER TABLE [forumForums]
  ADD [latestAuthorTmp] varchar(50)
  GO
  UPDATE [forumForums] SET [latestAuthorTmp] = CONVERT(varchar(50),[latestAuthor])
  GO
  ALTER TABLE [dbo].[forumForums] 
  DROP CONSTRAINT [DF_forumForums_latestAuthor]
  GO
  ALTER TABLE [forumForums]
  DROP COLUMN [latestAuthor]
  GO
  ALTER TABLE [forumForums]
  ADD [latestAuthor] varchar(50)
  GO
  UPDATE [forumForums] SET [latestAuthor] = [latestAuthorTmp]
  GO
  ALTER TABLE [forumForums]
  DROP COLUMN [latestAuthorTmp]
  GO
  
  /* Topics table */
  ALTER TABLE [forumTopics]
  ADD [latestReplyAuthorTmp] varchar(50)
  GO
  UPDATE [forumTopics] SET [latestReplyAuthorTmp] = CONVERT(varchar(50),[latestReplyAuthor])
  GO
  ALTER TABLE [forumTopics]
  DROP CONSTRAINT [DF_forumTopics_latestReplyAuthor]
  GO
  ALTER TABLE [forumTopics]
  DROP COLUMN [latestReplyAuthor]
  GO
  ALTER TABLE [forumTopics]
  ADD [latestReplyAuthor] varchar(50)
  GO
  UPDATE [forumTopics] SET [latestReplyAuthor] = [latestReplyAuthorTmp]
  GO
  ALTER TABLE [forumTopics]
  DROP COLUMN [latestReplyAuthorTmp]
  GO

  ALTER TABLE [forumTopics]
  ADD [memberIdTmp] varchar(50)
  GO
  UPDATE [forumTopics] SET [memberIdTmp] = CONVERT(varchar(50),[memberId])
  GO
  ALTER TABLE [forumTopics]
  DROP COLUMN [memberId]
  GO
  ALTER TABLE [forumTopics]
  ADD [memberId] varchar(50)
  GO
  UPDATE [forumTopics] SET [memberId] = [memberIdTmp]
  GO
  ALTER TABLE [forumTopics]
  DROP COLUMN [memberIdTmp]
  GO
  
  /* Comments table */

  ALTER TABLE [forumComments]
  ADD [memberIdTmp] varchar(50)
  GO
  UPDATE [forumComments] SET [memberIdTmp] = CONVERT(varchar(50),[memberId])
  GO
  ALTER TABLE [forumComments]
  DROP COLUMN [memberId]
  GO
  ALTER TABLE [forumComments]
  ADD [memberId] varchar(50)
  GO
  UPDATE [forumComments] SET [memberId] = [memberIdTmp]
  GO
  ALTER TABLE [forumComments]
  DROP COLUMN [memberIdTmp]
  GO
